<?php
/**
 * Auther: Joshua Conero
 * Date: 2017/7/9 0009 16:12
 * Email: brximl@163.com
 * Name: 用户认证处理
 */

namespace App\Http\Controllers\Index;

use App\Http\Controllers\Controller;
use hyang\Net;

class Bin extends Controller
{
    public function Action(){
        $result = request()->get('result');
        if(empty($result)){
            $name = 'center.app_key';
            $url = $this->getHomeUrl("/api/login/state?name=$name&key=".urlencode(config('app.key')).'&redirect='.urlencode(request()->getBaseUrl()));
            Net::go($url);
            exit;
        }
        $redirect = request()->get('redirect');
        if(empty($redirect)){
            Net::go(request()->getBaseUrl());
        }
        Net::go($redirect);
    }
    // 用户登录，用于ajax请求(平台登录)
    public function UserLogin(){
        $request = request();
        $input = $request->all();
        // 登录系统
        if(isset($input['pwsd']) && isset($input['user_code'])){}
        echo json_encode($input);
    }
}